package cate.common.table.activity.dailyrecharge.item;

import cate.common.table.ESheet;
import easy.java.dev.note.NoteClass;
import easy.java.dev.note.NoteField;

import java.util.HashMap;
import java.util.Map;

@NoteClass("每日充值-每日充值Sheet")
public class DailyRechargeItemSheet extends ESheet<DailyRechargeItemRow> {
    @NoteField("配置ID->最大天数")
    public Map<Integer, Integer> configIdToMaxDay = new HashMap<>();

    @Override
    public String getSheetName() {
        return "每日充值";
    }

    @Override
    public void decode() {
        super.decode();
        configIdToMaxDay.clear();
        for (DailyRechargeItemRow config : getList()) {
            if (configIdToMaxDay.containsKey(config.configId)) {
                if (config.dayIndex > configIdToMaxDay.get(config.configId)) {
                    configIdToMaxDay.put(config.configId, config.dayIndex);
                }
            } else {
                configIdToMaxDay.put(config.configId, config.dayIndex);
            }
        }
    }
}
